<?php


namespace app\index\controller;


use app\common\controller\CommonController;
use app\common\enum\MainEnum;
use app\common\model\MapModel;
use app\common\service\WarmUpCache;
use app\common\service\Lang;
use think\facade\Cache;

class MapController extends CommonController
{
    public function getMapList()
    {
        $data = Cache::store('file')
            ->get('map');
        if (!$data) {
            $models = (new MapModel())->getMapList();
            if ($models->isEmpty()) {
                $data = [];
            }
            else {
                $data = $models->toArray();
            }
            Cache::store('file')
                ->set('map', $data);
        }
        return retJson(Lang::GETDone, getPidParent($data));
    }
}